package com.itshare.video.mapper;

import com.itshare.video.pojo.po.VideoList;
import com.itshare.video.pojo.po.VideoListExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.session.RowBounds;

public interface VideoListMapper {
    long countByExample(VideoListExample example);

    int deleteByExample(VideoListExample example);

    @Delete({
        "delete from t_video_list",
        "where video_list_id = #{videoListId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer videoListId);

    @Insert({
        "insert into t_video_list (video_list_title, video_list_content, ",
        "delete_status, user_id)",
        "values (#{videoListTitle,jdbcType=VARCHAR}, #{videoListContent,jdbcType=VARCHAR}, ",
        "#{deleteStatus,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="videoListId", before=false, resultType=Integer.class)
    int insert(VideoList record);

    int insertSelective(VideoList record);

    List<VideoList> selectByExampleWithRowbounds(VideoListExample example, RowBounds rowBounds);

    List<VideoList> selectByExample(VideoListExample example);

    @Select({
        "select",
        "video_list_id, video_list_title, video_list_content, delete_status, user_id",
        "from t_video_list",
        "where video_list_id = #{videoListId,jdbcType=INTEGER}"
    })
    @ResultMap("com.itshare.video.mapper.VideoListMapper.BaseResultMap")
    VideoList selectByPrimaryKey(Integer videoListId);

    int updateByExampleSelective(@Param("record") VideoList record, @Param("example") VideoListExample example);

    int updateByExample(@Param("record") VideoList record, @Param("example") VideoListExample example);

    int updateByPrimaryKeySelective(VideoList record);

    @Update({
        "update t_video_list",
        "set video_list_title = #{videoListTitle,jdbcType=VARCHAR},",
          "video_list_content = #{videoListContent,jdbcType=VARCHAR},",
          "delete_status = #{deleteStatus,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=INTEGER}",
        "where video_list_id = #{videoListId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(VideoList record);
}